320 ◾ Bioinformatics
do
samtools faidx ${i}
done
bowtie2-build healthy_scaffolds.fasta healthy
bowtie2-build moderate_scaffolds.fasta moderate
bowtie2-build severe_scaffolds.fasta severe
Once the index has been built, we can use Bowtie2 to align the FASTQ reads to their
respective “scaffolds.fasta”.
mkdir sam_assemblies
bowtie2 --sensitive-local \
-p 4 \
-x assemblies/healthy \
-1 fastq_pure/ERR1823587_pure_R1-50.fastq.gz \
-2 fastq_pure/ERR1823587_pure_R2-50.fastq.gz \
-S sam_assemblies/ERR1823587_healthy.sam
bowtie2 --sensitive-local \
-p 4 \
-x assemblies/moderate \
-1 fastq_pure/ERR1823601_pure_R1-50.fastq.gz \
-2 fastq_pure/ERR1823601_pure_R2-50.fastq.gz \
-S sam_assemblies/ERR1823601_moderate.sam
bowtie2 --sensitive-local \
-p 4 \
-x assemblies/severe \
-1 fastq_pure/ERR1823608_pure_R1-50.fastq.gz \
-2 fastq_pure/ERR1823608_pure_R2-50.fastq.gz \
-S sam_assemblies/ERR1823608_severe.sam
We can notice that there are some statistics when the alignment process finishes for each
sample.
We will convert SAM files to bam files and then we will sort the alignments in the BAM
files.
cd sam_assemblies
samtools view -S -b ERR1823587_healthy.sam > ERR1823587_healthy.
bam
samtools view -S -b ERR1823601_moderate.sam > ERR1823601_moderate.
bam
samtools view -S -b ERR1823608_severe.sam > ERR1823608_severe.bam
for i in $(ls *.bam);
do
samtools sort -@ 4 ${i} -o ${i}.sorted
done